<!--<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>      -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<?php
include_once("PHP/PostContainer.php");
include_once("PHP/reddit.php");
include_once("PHP/4chanParser.php");
include_once("PHP/gmail.php");
include_once("PHP/dummyParser.php");
?>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="Css/index.css" />
	<link rel="stylesheet" href="fancybox/source/jquery.fancybox.css?v=2.1.4" type="text/css" media="screen" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/index.js"></script>
	<script type="text/javascript" src="fancybox/source/jquery.fancybox.js"></script>
	<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
	<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/sha256.js"></script>
</head>
<body id="pageBody">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<div id="bannerHolder">
    <div id="pageHead">
        <h1 id="Logo">
            <a href="index.php">SuperScraper</a>
        </h1>
        <div id="searchBar">
            <form rel="async" >
                <input type="hidden" name="dff_view" value="grid">
                <input type="text" name="search_field" size="45" maxlength="50"><input type="button" value="Clear">
            </form>
        </div>
        <div id="rfloat">
            <u1 id="account">
                <a id="accountdetails" href="accountpage.php">
                    Create a new Account
                </a>
				or
				<a id="accountLogin" href="#inlineLogin" class="" >
					Log in
				</a>
            </u1>
        </div>
    </div>

</div>
    <div id="globalContainer" class="uiContextualLayerParent">
          <div id="content" class="page_content">
            <div id="mainContainer">
             <div id="contentCol" class="mainLayout">
                 <div id="leftColContainer">
                     <div id="leftCo" role="complementary">
                         <a id="ad"></a>
                     </div>
                 </div>
                 <div id="contentArea" role="main">

                 <div id = "mainResults">
                     <table id="listingTable">
                         <tr id="listingTableHead">
                            <th id="listerHead">
                                Post
                            </th>
                             <th id="listerImage">
                                Image
                             </th>
                         </tr>
                         <tbody id="listingTableBody">
						 <?php 
							@$in = $_GET["parsers"];
							$con = new PostContainer();
							if($in==null) {
								$con->addParser(new RedditParser(""));
								$con->addParser(new forchanParser());
								@$con->addParser(new GmailParser("superscraperdummytester1001@gmail.com","ss#1ss#1"));
							}
							else {
								$con->addParsersByArray($in);
							}
							$con->populatePosts();
							while (($post = $con->getNextPost()) != null) { ?>
								 <tr class=<?php echo $post->parent . "_post";?>>
									 <td><a href=<?php echo $post->url; ?> class="replylink"><?php echo  $post->content;?></a></td>
									 <td><a class="thumbnail" href=<?php echo $post->image; ?> ><img src=<?php echo $post->image; ?> width="70" height="70" alt=""></a></td>
								 </tr>
                         <?php } ?>
                         </tbody>
                     </table>
                 </div>
                 </div>

             </div>
            </div>
          </div>
    </div>

<div id="toolbar">
	<div id="settingsContainer" style="display: none;">
		<div id="settingsContent">
			<p id="scrapperSettingsTitle">Added Scrappers:</p>
				<div id="listofsettings">
				<ul id="sortable">
					<?php $i=0; foreach($con->parsers as $parser) {?>
					<li class="ui-state-default">
						<div class="parsersSettings">
							<p><?php echo $parser->name?>:</p>Enable
							<input type="checkbox" name=<?php echo "enable_".$parser->name?> value=<?php echo $parser->name?> <?php if($parser->status) echo "checked='yes'";?> >
						</div>
					</li>
					<?php $i++;}?>
				</ul>
				
				</div>
				<button type="button" id="changeOrder">Change Order</button><br>
				<button type="button" href="#inlineAddParser" class="modalbox" >Add Parser</button><br>
				<button type="button" href="#inlineRemoveParser" class="modalbox" >Remove Parser</button>
		</div>
	</div>
	<div id="iconContainer" >
		<div id="settings_icon" class="icon">
			<a id="settings_button"></a>
		</div>
		<div id="save_icon" class="icon">
			<a id="save_button"></a>
		</div>
	</div>
</div>

<!--From: http://designwoop.com/2012/07/tutorial-coding-a-jquery-popup-modal-contact-form/ -->
<div id="inlineLogin" class="popup">
<form id="login" action="login.php"" method="get">
	<div id="loginForm">
		<input id="userName" placeholder="Username" name="user"><br>
		<input type="password" id="Loginpassword" placeholder="Password" name="password">
		<button type="submit" value="Submit" id="sendLogin">Login</button><br>
	</div>
</form>
</div>

<div id="inlineAddParser" class="popup">
<form id="addparser" action="#" method="get" name="contact">
	<select id="availableParsers">
		<option value="Reddit">Reddit</option>
		<option value="4Chan">4Chan</option>
		<option value="Gmail">Gmail</option>
	</select>
	<button type="submit" id="sendAdd">Add Parser</button><br>
	<input id="extraSubredditInput" class="extraInput" placeholder="Subreddit (Optional)"></input>
	<div id="extraGmailInput" class="extraInput" style="display: none;">
		<input id="gmailUsername" placeholder="Username"></input><br>
		<input type="password" id="gmailPassowrd" placeholder="Password"></input>
	</div>
	</form>
</div>

<div id="inlineRemoveParser" class="popup">
<form id="removeparser" action="#" method="get" name="contact">
	<select id="removableParsers">
		<?php foreach($con->parsers as $parser) {?>
			<option value=<?php echo $parser->name?>><?php echo $parser->name?></option>
		<?php }?>
	</select>
	<button type="submit" id="sendRemove">Remove Parser</button>
	</form>
	
</div>
	
</body>



</html>